<script type="text/javascript">
	function edit() {
		$("#saved_story").fadeOut();
		$("#edit_box").fadeIn();
		$("#update_info").remove();
	}
</script>

<div id="main-content" class="prepend-1 span-19 last">

	<h3>Cerita Singkat Mengenai Kondisi Ekonomi dan Keluarga</h3>
	
<?php
	$story = set_value('story', $story);
	$box_color = '#dfe5e6';
	
	if ($updatestatus == 'success') {
		echo '<div id="update_info"><span class="info">Cerita Singkat berhasil disimpan.</span><br /><br /></div>';
		$box_color = '#fcf9a3';
		
	} else if ($updatestatus == 'failed') {
		echo '<div id="update_info"><span class="error">Cerita Singkat gagal disimpan. Silakan coba beberapa saat lagi.</span><br /><br /></div>';
		$story = $laststory;
	}
?>

<?php 
	if ($date != '') {
		$time = mysql_to_unix($date);
		echo '<h4>Tanggal Update: '.mdate(DATE_FORMAT, $time).'</h4>';
	}
?>

	<div id="saved_story" class="clear">
		<div style="background-color: <?php echo $box_color; ?>; padding: 10px; width:692px;">
			<?php
				echo html_entity_decode($story);
			?>
		</div>
		<br />
		<input type="button" class="submit" name="edit" value="Ubah" onclick="edit()" />
	</div>
	
	<div id="edit_box" class="clear" style="display: none;">
<?php echo form_open('mahasiswa/profile/story/index', array('class' => 'form')); ?>
		<?php echo form_error('story'); ?>
		<textarea rows="" cols="" name="story" class="textedit"><?php echo $story; ?></textarea>
		<br />
		
		<input type="submit" value="Simpan" name="update" class="submit" />
<?php echo form_close(); ?>
	</div>
	<div class="clear"><?php echo nbs(); ?></div>
</div>
